import SparkMD5 from 'spark-md5'
// 获取文件md5
export function getFileMd5(file) {
  return new Promise((resolve, reject) => {
    let fileReader = new FileReader()
    let Spark = new SparkMD5.ArrayBuffer()
    fileReader.readAsArrayBuffer(file)
    fileReader.onload = function (e) {
      Spark.append(e.target.result)
      let md5 = Spark.end()
      resolve(md5)
    }
  })
}
